<template>
    <h3>个人资产信息</h3>
    <table>
        <tr>
            <td>登录名称</td>
            <td>
                {{ data.UL_Name }}
            </td>
        </tr>
        <tr>
            <td>投资总额</td>
            <td>
                {{ data.SumUI_Money.toFixed(2) }}CNY
            </td>
        </tr>
        <tr>
            <td>理财总额</td>
            <td>
                {{ data.SumUF_Money.toFixed(2) }}CNY
            </td>
        </tr>
    </table>
</template>

<script setup lang="ts">
import 'bootstrap/dist/css/bootstrap.min.css'
import 'bootstrap/dist/js/bootstrap.min.js'
import { onMounted, ref } from 'vue'
import axios from 'axios';
import { useUserStore } from '../../store/index.ts'

//实例仓库
const userStore = useUserStore();

const data = ref({
    UL_Name: '',
    SumUI_Money: 0,
    SumUF_Money: 0
})

onMounted(() => {
    axios({
        method: "get",
        url: "https://localhost:44305/api/Users/ShowUserAssetInfo",
        params: {
            Uid: userStore.UserLoginId
        }
    })
        .then(function (res) {
            console.log(res.data);
            data.value.UL_Name = res.data[0].UL_Name;
            data.value.SumUI_Money = res.data[0].SumUI_Money;
            data.value.SumUF_Money = res.data[0].SumUF_Money;
        })

})

</script>